<form method="post" id="ajaxForm">
    <div class="panel one-box">
       <div class="table-responsive">
        <table id="table" class="table table-hover ">
            <tbody>
                <tr>
                    <th width="*">说明</th>
                    <th width="*">路径</th>
                    <th width="*">大小</th>
                    <th width="100">操作</th>
                </tr>
                <foreach name="list" item="vo">
                <tr>
                    <td>{$vo.name}</td>
                    <td>{$vo.dir}</td>
                    <td>{$vo.size}</td>
                    <td>
                        <a id="cacheDel" class="button bg-red button-small icon-trash-o js-del" href="javascript:;" data="{$vo.id}" title="清空缓存"></a>
                    </td>
                </tr>
                </foreach>
            </tbody>
        </table>
        </div>
    </div>
</form>

<script type="text/javascript">
    // ajax 提交表单
    $(document).ready(function(){
        $("[id = cacheDel]").click(function(){    // 提交按钮触发事件
            var $cacheName = $(this).attr('data');
            //询问框
            layer.confirm('你确认执行清空缓存操作？', {
                icon: 4,
                btn: ['确定','取消'], //按钮
            }, function(){
                $.post('{:U('Manage/cache')}',{cacheName:$cacheName},function(data){
                    if(data['status'] == 1){    // 处理成功后
                        layer.msg(data['info'], {icon: 1});
                    } else {
                        layer.msg(data['info'], {icon: 0});
                    }
                    // 等待1秒后刷新当前页面
                    setTimeout("window.location.reload()",1000);
                });
            }, function(){
                layer.close();
            });
        });
    });
</script>